from ..bot_plugin import Bot_plugin
from cqhttp import CQHttp
from bot_body import Bot_body
import logging
import colorful

class Plugin_invite(Bot_plugin):
    def __init__(self, bot_body: Bot_body, name="Protector"):
        Bot_plugin.__init__(self, bot_body, name=name)
        self.help_msg="【邀请助手帮助】"

    def register_all(self):
        self.register('request')


    def handle_request(self, context):
        if context['request_type'] == 'group' and context['sub_type']=='invite':
            if context['user_id'] in self.master_qqs:
                self.bot.set_group_add_request(
                    flag=context['flag'],
                    sub_type='invite',
                    approve=True
                )
            